<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>背景管理</title>
<link rel="stylesheet" type="text/css" href="control.css"/>
<link rel="stylesheet" type="text/css" href="control_main.css" />
<script type="text/javascript">
window.onload = function(){
	searchInfo();
}
function searchInfo(){
	clearUlInner();
	var url = "/networkforum/control/back_control.do";
	
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get(url,function(d){
		var data = toJson(d);
		//page.view('articleInner',article,articleOption);
		page.view("rightUlInner",data.modules.slice(0,15),backOption);
		//infoOption.data = data.moduleInfos;
		window.parent.iFrameHeight();
		paging.page({
			size:15,
			total:Math.ceil(data.modules.length/15),
			ajaxLoad:false,
			data:data.modules,
			previou:document.getElementById("previouPage"),
			next:document.getElementById("nextPage"),
			current:document.getElementById("currentPage"),
			max:document.getElementById("totalPage"),
			callBack:function(d){
				clearUlInner();
				page.view("rightUlInner",d,backOption);
			},
		});
	});
	myajax = null;
}
/*function showInfos(event){
	event = event || window.event;
	var target = event.target || event.srcElement;
	info.target = target;
	var infoInner = document.getElementById("infoInner");
	target.parentElement.appendChild(infoInner);
	page.combo("infoInner",info,infoOption);
}
var info = {
	target:null,
	data:null
}
var infoOption = {
	informationName:{
		param:{id:'infoLi'},
		bind:{moduleInformationId:'moduleInfomationId'},
	}
};*/
var backOption = {
	moduleName:{
		param:{id:"moduleName"},
		bind:{moduleId:"moduleId",},
		style:{color:"blue"}
	},
	moduleCss:{
		param:{id:"cssUrl"},
	},
	moduleState:{
		param:{id:"moduleState"},
	},
	informationName:{
		param:{id:"informationName"},
	}
}
function userHandle(event){
	event = event || window.event;
	var target = event.target || event.srcElement;
	//var handle = document.getElementById("handle");
	//target.parentElement.appendChild(handle.cloneNode(true));
	var option = {
			'name':{
				'param':{'id':"typeName"}
			}
		};
	var param = {
			'data':[{'name':"美女"},{'name':"性感"}],
			'target':target,
		};
	page.combo("type",param,option);
}
function save(){
	var items = document.getElementsByClassName("checkBox");
	
	var len = items.length;
	var moduleIds = new Array();
	var csss = new Array();
	for(var i =0;i<len ;i++){
		var ite = items[i];
		if(ite.checked){
			var li = ite.parentElement;
			var moduleId = li.children[1].moduleId;
			var css = li.children[2].value;
			//arr.push({userId:userId,roleName:roleName});
			moduleIds.push(moduleId);
			csss.push(css);
		}
	}
	if(moduleIds.length==0){
		return;
	}
	var url = "/networkforum/control/back_control_change.do";
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get(url+"?moduleIds="+moduleIds+"&csss="+csss,function(d){
		searchInfo();
	});
	myajax = null;
}
</script>
</head>

<body>
    <div id="userCenter" class="rightCenter">
        <ul id="rightUlInner" class="rightUlInner">
            <li id="module" style="display:none;">
                <input class="checkBox" type="checkbox" style="width:5%;margin-right:4px;"/>
				<input id="moduleName" readonly="readonly" value=" " style="width:20%;"></input>
                <input id="cssUrl" value=" " style="width:34%;"></input>
                <span id="informationName" style="width:20%;"></span>
                <span id="moduleState" style="width:10%;"></span>
            </li>
            <li id="header">
                <span style="width:5%;">全部</span>
                <span style="width:20%;text-align:left;">模块名</span>
                <span style="width:35%;text-align:left;">样式路径</span>
                <span style="width:20%;">名称</span>
                <span style="width:10%;">状态</span>
            </li>
        </ul>
     <div class="paging" id="paging">
	   		<div class="clear"></div>
	   		<span id="previouPage" style="cursor: pointer;">上一页</span>
	   		<!--  <span id="currentPage2">1</span>-->
	   		<input id="currentPage" type="text" value = "1"/>	
	   		<span id="nextPage" style="cursor: pointer;">下一页</span>
	   		<span id="totalPage">共 1 页</span>
	   	</div>
     </div>
     <span onclick="save();" style="display:inline-block;padding:3px 30px;border-radius:5px;border:1px solid #ccc;margin-top:5px;cursor:pointer;">保存</span>
</body>
<script type="text/javascript" src="control_main.js"></script>
<script src="../js/view.js" type="text/javascript"></script>
<script src="../js/combo.js" type="text/javascript"></script>
<script src="../js/myajax.js" type="text/javascript"></script>
<script src="../js/pageing.js" type="text/javascript"></script>
</html>
